package com.cadre.web.controller.officer;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.cadre.common.utils.R;
import com.cadre.system.domain.officer.*;
import com.cadre.system.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

@Api(tags = {"首页接口"})
@RequestMapping({"/profess/homeindex"})
@RestController
/* loaded from: HomeIndexController.class */
public class HomeIndexController {
//    @Resource
//    private SysRoleDataService SysRoleDataService;
    @Autowired
    private IndexCountService indexService;
    @Resource
    private ChartMsgService chartMsgService;
    @Autowired
    private A01Service a01Service;
    @Autowired
    private UnitInfoService unitService;
    @Autowired
    private SysConfigService sysConfigService;
    @Autowired
    private A79Service a79Service;
    @Resource
    private WarningIndexService warningIndexService;
    @Resource
    private RetirementService retirementService;

    //todo:: 下面4个接口需要重新编写
//    @GetMapping({"/roledata/{roleId}"})
//    @ApiOperation("获取人员数据权限")
//    public R roledata(@PathVariable("roleId") String roleId) {
//        return R.ok().put("roledata", (Object) this.SysRoleDataService.queryRoleDataList(roleId));
//    }
//
//    @GetMapping({"/userdata/{userId}"})
//    @ApiOperation("获取人员数据权限")
//    public R userdata(@PathVariable("userId") String userId) {
//        return R.ok().put("roledata", (Object) this.SysRoleDataService.queryUserDataList(userId));
//    }
//
//    @GetMapping({"/roledatamain/{roleId}"})
//    @ApiOperation("获取人员主管单位")
//    public R roledatamain(@PathVariable("roleId") String roleId) {
//        return R.ok().put("roledata", (Object) this.SysRoleDataService.queryMainRoleDataList(roleId));
//    }
//
//    @GetMapping({"/userdatamain/{userId}"})
//    @ApiOperation("获取人员主管单位")
//    public R userdatamain(@PathVariable("userId") String userId) {
//        return R.ok().put("roledata", (Object) this.SysRoleDataService.queryMainUserDataList(userId));
//    }

    @GetMapping({"/category/{roleId}/{unitCode}"})
    @ApiOperation("获取干部情况统计数据(按部门)")
    public List<Chart> totalCadre(@PathVariable("roleId") String roleId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalCadre(roleId, unitCode);
    }

    @GetMapping({"/categoryUser/{userId}/{unitCode}"})
    @ApiOperation("获取干部情况统计数据(按部门)")
    public List<Chart> totalCadreUser(@PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalCadreUser(userId, unitCode);
    }

    @GetMapping({"/category/{roleId}"})
    @ApiOperation("获取干部情况统计数据(初始化)")
    public List<Chart> totalCadre(@PathVariable("roleId") @ApiParam("用户ID") String roleId) {
        return this.indexService.totalCadre(roleId, null);
    }

    @GetMapping({"/categoryUser/{userId}"})
    @ApiOperation("获取干部情况统计数据(初始化)")
    public List<Chart> totalCadreUser(@PathVariable("userId") String userId) {
        return this.indexService.totalCadreUser(userId, null);
    }

    @GetMapping({"/educationUser/{userId}/{unitCode}"})
    @ApiOperation("获取学历结构统计数据(按部门)")
    public List<Chart> totalEducationUser(@PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalEducationUser(userId, unitCode);
    }

    @GetMapping({"/education/{roleId}/{unitCode}"})
    @ApiOperation("获取学历结构统计数据(按部门)")
    public List<Chart> totalEducation(@PathVariable("roleId") String roleId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalEducation(roleId, unitCode);
    }

    @GetMapping({"/education/{roleId}"})
    @ApiOperation("获取学历结构统计数据(初始化)")
    public List<Chart> totalEducation(@PathVariable("roleId") String roleId) {
        return this.indexService.totalEducation(roleId, null);
    }

    @GetMapping({"/educationUser/{userId}"})
    @ApiOperation("获取学历结构统计数据(初始化)")
    public List<Chart> totalEducationUser(@PathVariable("userId") String userId) {
        return this.indexService.totalEducationUser(userId, null);
    }

    @GetMapping({"/institution/{roleId}/{unitCode}"})
    @ApiOperation("获取机构情况统计数据（按部门）")
    public List<Chart> totalInstitution(@PathVariable("roleId") String roleId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalInstitution(roleId, unitCode);
    }

    @GetMapping({"/institutionUser/{userId}/{unitCode}"})
    @ApiOperation("获取机构情况统计数据（按部门）")
    public List<Chart> totalInstitutionUser(@PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        return this.indexService.totalInstitutionUser(userId, unitCode);
    }

    @GetMapping({"/institution/{roleId}"})
    @ApiOperation("获取机构情况统计数据（初始化）")
    public List<Chart> totalInstitution(@PathVariable("roleId") String roleId) {
        return this.indexService.totalInstitution(roleId, null);
    }

    @GetMapping({"/institutionUser/{userId}"})
    @ApiOperation("获取机构情况统计数据（初始化）")
    public List<Chart> totalInstitutionUser(@PathVariable("userId") String userId) {
        return this.indexService.totalInstitutionUser(userId, null);
    }

    @GetMapping({"/chartAge/{roleId}/{unitCode}"})
    @ApiOperation("获取年龄统计数据（按部门）")
    public List<Chart> totalAgeByTagid(@PathVariable("roleId") String roleId, @PathVariable("unitCode") String unitCode) {
        return this.chartMsgService.totalAgeByTagid(roleId, unitCode);
    }

    @GetMapping({"/chartAge/{roleId}"})
    @ApiOperation("获取年龄统计数据（初始化）")
    public List<Chart> totalAgeByTagid(@PathVariable("roleId") String roleId) {
        return this.chartMsgService.totalAgeByTagid(roleId, null);
    }

    @GetMapping({"/chartAgeUser/{userId}"})
    @ApiOperation("获取年龄统计数据（初始化）")
    public List<Chart> totalUserAgeByTagid(@PathVariable("userId") String userId) {
        return this.chartMsgService.totalAgeByA01Static(userId, null);
    }

    @GetMapping({"/chartAgeUser/{userId}/{unitCode}"})
    @ApiOperation("获取年龄统计数据（按部门）")
    public List<Chart> totalUserAgeByTagid(@PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        return this.chartMsgService.totalAgeByA01Static(userId, unitCode);
    }

    @GetMapping({"/chartAll/{tagId}/{roleId}/{unitCode}"})
    @ApiOperation("获取各类统计数据（按部门）")
    public List<Chart> chartAll(@PathVariable("tagId") String tagId, @PathVariable("roleId") String roleId, @PathVariable("unitCode") String unitCode) {
        return this.chartMsgService.totalAllByTagid(tagId, roleId, unitCode);
    }

    @GetMapping({"/chartAllUser/{tagId}/{userId}/{unitCode}"})
    @ApiOperation("获取各类统计数据（按部门）")
    public List<Chart> chartAllUser(@PathVariable("tagId") String tagId, @PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        return this.chartMsgService.totalAllUserByTagid(tagId, userId, unitCode);
    }

    @GetMapping({"/chartAll/{tagId}/{roleId}"})
    @ApiOperation("获取各类统计数据（初始化）")
    public List<Chart> chartAll(@PathVariable("tagId") String tagId, @PathVariable("roleId") String roleId) {
        return this.chartMsgService.totalAllByTagid(tagId, roleId, null);
    }

    @GetMapping({"/chartAllUser/{tagId}/{userId}"})
    @ApiOperation("获取各类统计数据（初始化）")
    public List<Chart> chartAllUser(@PathVariable("tagId") String tagId, @PathVariable("userId") String userId) {
        return this.chartMsgService.totalAllUserByTagid(tagId, userId, null);
    }

    @GetMapping({"/totalWarningReport/{userId}/{unitCode}"})
    @ApiOperation("获取预警数据（按部门）")
    public List<Chart> totalWarningReport(@PathVariable("userId") String userId, @PathVariable("unitCode") String unitCode) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        Map<String, Object> map = new HashMap<>();
        List<Chart> list = new ArrayList();
        warningIndexList.removeIf(next->next.getIsShow() ==1);
        for (WarningIndex warningIndex : warningIndexList) {
            switch (warningIndex.getKey()) {
                case "参加工作信息":
                    map.put("WORK_ENTER_AGE", warningIndex.getValue());
                    break;
                case "入党信息":
                    map.put("PARTY_ENTER_AGE", warningIndex.getValue());
                    break;
                case "退休人员信息": // 需要计算新的人员即将退休时间
                    String value = warningIndex.getValue(); // N个月
                    int months = Integer.parseInt(value); // 将字符串转换为整数
                    LocalDate currentDate = LocalDate.now(); // 获取当前日期
                    LocalDate futureDate = currentDate.plusMonths(months); // 计算N个月后的日期
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
                    String formattedDate = futureDate.format(formatter); // 将日期格式化为字符串
                    LambdaQueryWrapper<Retirement>  ret = new LambdaQueryWrapper<>();
                    ret.ge(Retirement::getRetirement, formattedDate);
                    List<Retirement> list1 = retirementService.list(ret);
                    List<String> ids = list1.stream().map(Retirement::getFlowid).collect(Collectors.toList());
                    Chart chart = new Chart("3", "不满" + value + "个月即将退休人员数量", ids.size());
                    list.add(chart);
                    break;
                case "现任职务层次信息":
                    map.put("RANKNAME", warningIndex.getrank());
                    map.put("RANK_YEAR", warningIndex.getValue());
                    break;
                case "现职级信息":
                    map.put("LEVELNAME", warningIndex.getrank());
                    map.put("LEVEL_YEAR", warningIndex.getValue());
                    break;
                case "任现职信息":
                    map.put("CURRENT_YEAR", warningIndex.getValue());
                    break;
                case "奖励信息":
                    map.put("REWARD_YEAR", warningIndex.getValue());
                    break;
                case "惩戒信息":
                    map.put("PUNISH_YEAR", warningIndex.getValue());
                    break;
                case "超配信息":
                    list.addAll(this.unitService.getSurpassUnitCount(userId, null));//超配单位
                    break;
                case "缺配信息":
                    list.addAll(this.unitService.getMissUnitCount(userId, null));//缺配单位
                    break;
                default:
                    break;
            }
        }
        StringBuffer sbBuffer = createWarningSQL(map);
        if (sbBuffer != null && sbBuffer.length() > 0) {
            list.addAll(this.indexService.totalWarningReportByStringBuffer(userId, unitCode, sbBuffer.toString()));
        }
        try {
            if (map.get("OVERMATCH").toString().equals("TRUE")) {
                list.addAll(this.unitService.getSurpassUnitCount(userId, unitCode));
            }
        } catch (Exception e2) {
        }
        try {
            if (map.get("UNDERMATCH").toString().equals("TRUE")) {
                list.addAll(this.unitService.getMissUnitCount(userId, unitCode));
            }
        } catch (Exception e3) {
        }
        return list;
    }

    private StringBuffer createWarningSQL(Map<String, Object> map) {
        StringBuffer sbBuffer = new StringBuffer();
        int no = 1;
        try {
            if (map.containsKey("WORK_ENTER_AGE")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 8 AS TYPE,flowid AS personid,'" + "不满X周岁参加工作".replace("X", map.get("WORK_ENTER_AGE").toString()) + "' AS typename FROM  (SELECT flowid,FLOOR (MONTHS_BETWEEN (a0138, a0106)) / 12 AS years FROM a01  ) WHERE years < " + map.get("WORK_ENTER_AGE").toString() + " AND years >= 0 ");
                no++;
            }
        } catch (Exception e5) {
        }
        try {
            if (map.containsKey("PARTY_ENTER_AGE")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + "SELECT 9 AS TYPE,flowid AS personid,'" + "不满X周岁入党".replace("X", map.get("PARTY_ENTER_AGE").toString()) + "' AS typename FROM  (SELECT a01.flowid,a01.a0106,a22.a2210 FROM a01  LEFT JOIN a22 ON a22.personid = a01.FLOWID  WHERE NOT REGEXP_LIKE ( a01.a0184A, '^[^[:digit:]]+$' )  AND FLOOR ( MONTHS_BETWEEN (a22.a2210, a01.a0106) ) / 12 < " + map.get("PARTY_ENTER_AGE").toString() + " ) ");
                no++;
            }
        } catch (Exception e6) {
        }
        try {//职务
            if (map.containsKey("RANKNAME") && map.containsKey("RANK_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 1 AS TYPE,flowid AS personid,'" + "任X时间满Y年的人员".replace("X", map.get("RANKNAME").toString()).replace("Y", map.get("RANK_YEAR").toString()) + "' AS typename FROM  (SELECT flowid,A0180,a0179 FROM a01  ) WHERE TRUNC( MONTHS_BETWEEN (SYSDATE, a0180) / 12) >= " + map.get("RANK_YEAR").toString() + "  and a0179 = '" + map.get("RANKNAME").toString() + "' ");
                no++;
            }
        } catch (Exception e7) {
        }
        try {//职级
            if (map.containsKey("LEVELNAME") && map.containsKey("LEVEL_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 2 AS TYPE,flowid AS personid,'" + "任X时间满Y年的人员".replace("X", map.get("LEVELNAME").toString()).replace("Y", map.get("LEVEL_YEAR").toString()) + "' AS typename FROM  (SELECT flowid,A0142,a0198 FROM a01  ) WHERE TRUNC( MONTHS_BETWEEN (SYSDATE, A0142) / 12) >= " + map.get("LEVEL_YEAR").toString() + "  and a0198 = '" + map.get("LEVELNAME").toString() + "' ");
                no++;
            }
        } catch (Exception e8) {
        }
        try {
            if (map.containsKey("REWARD_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 4 AS TYPE,flowid AS personid,'" + "近X年受到奖励".replace("X", map.get("REWARD_YEAR").toString()) + "' AS typename FROM  (SELECT DISTINCT a01.flowid,a26.a2625 FROM a01  LEFT JOIN a26 ON a26.personid = a01.FLOWID WHERE a26.FLAG = 1  and to_number(to_char( a26.a2625,'yyyy'))+" + map.get("REWARD_YEAR") + " >= to_number(to_char(SYSDATE,'yyyy')))");
                no++;
            }
        } catch (Exception e9) {
        }
        try {
            if (map.containsKey("PUNISH_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 5 AS TYPE,flowid AS personid,'" + "近X年受到惩戒".replace("X", map.get("PUNISH_YEAR").toString()) + "' AS typename FROM  (SELECT DISTINCT a01.flowid,a26.a2625 FROM a01  LEFT JOIN a26 ON a26.personid = a01.FLOWID WHERE a26.FLAG = 2  and to_number(to_char( a26.a2625,'yyyy'))+" + map.get("PUNISH_YEAR") + " >= to_number(to_char(SYSDATE,'yyyy')))");
                no++;
            }
        } catch (Exception e10) {
        }
        try {
            if (map.containsKey("ASSESSMENT_1") && map.containsKey("ASSESSMENT_1_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 9.1 AS TYPE,flowid AS personid,'" + "近Y年考核等次为X".replace("X", map.get("ASSESSMENT_1").toString()).replace("Y", map.get("ASSESSMENT_1_YEAR").toString()) + "' AS typename FROM  (SELECT DISTINCT a16.personid as flowid,a16.a1602,a16.A1601 FROM a16  WHERE a1602 = '" + map.get("ASSESSMENT_1").toString() + "'  AND A1601 >= to_char((SELECT EXTRACT (YEAR FROM SYSDATE) - " + map.get("ASSESSMENT_1_YEAR").toString() + " FROM dual) ))");
                no++;
            }
        } catch (Exception e11) {
        }
        try {
            if (map.containsKey("ASSESSMENT_2") && map.containsKey("ASSESSMENT_2_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 9.2 AS TYPE,flowid AS personid,'" + "近Y年考核等次为X以上".replace("X", map.get("ASSESSMENT_2").toString()).replace("Y", map.get("ASSESSMENT_2_YEAR").toString()) + "' AS typename FROM  (SELECT DISTINCT a16.personid as flowid,a16.a1602,a16.A1601 FROM a16  right join DIC_ZB18 on DIC_ZB18.NAME = a16.a1602  WHERE DIC_ZB18.ORDERID <(select tmp.ORDERID from DIC_ZB18 tmp WHERE tmp.NAME = '" + map.get("ASSESSMENT_2").toString() + "')  AND A1601 >=  to_char((SELECT EXTRACT (YEAR FROM SYSDATE) - " + map.get("ASSESSMENT_2_YEAR").toString() + " FROM dual)) )");
                no++;
            }
        } catch (Exception e12) {
        }
        try {
            if (map.containsKey("ASSESSMENT_3") && map.containsKey("ASSESSMENT_3_YEAR")) {
                sbBuffer.append((no == 1 ? "" : " UNION ") + " SELECT 9.3 AS TYPE,flowid AS personid,'" + "近Y年考核等次为X以下".replace("X", map.get("ASSESSMENT_3").toString()).replace("Y", map.get("ASSESSMENT_3_YEAR").toString()) + "' AS typename FROM  (SELECT DISTINCT a16.personid as flowid,a16.a1602,a16.A1601 FROM a16  right join DIC_ZB18 on DIC_ZB18.NAME = a16.a1602  WHERE DIC_ZB18.ORDERID >(select tmp.ORDERID from DIC_ZB18 tmp WHERE tmp.NAME = '" + map.get("ASSESSMENT_3").toString() + "')  AND A1601 >=  to_char((SELECT EXTRACT (YEAR FROM SYSDATE) - " + map.get("ASSESSMENT_3_YEAR").toString() + " FROM dual)) )");
                no++;
            }
        } catch (Exception e13) {
        }
        return sbBuffer;
    }

    @GetMapping({"/totalWarningReportByUser/{userId}"})
    @ApiOperation("获取预警数据（全部按用户）")
    public List<Chart> totalWarningReportByUser(@PathVariable("userId") String userId) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();  //查询ISYS_CONFIG表拿到备注为预警的，目前结果为空
        Map<String, Object> map = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                map.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                map.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        List<Chart> list = new ArrayList();
        StringBuffer sbBuffer = createWarningSQL(map);
        if (sbBuffer != null && sbBuffer.length() > 0) {
            list = this.indexService.totalWarningReportByStringBuffer(userId, null, sbBuffer.toString());
        }
        try {
            list.addAll(this.unitService.getFull63InAppointUnit());//人大、政协领导班子成员中的党外干部年满63周岁
        } catch (Exception e2) {
        }
        try {
            list.addAll(this.unitService.getPunish());//在处分期内干部人员
        } catch (Exception e3) {
        }
        Object current_year = map.get("CURRENT_YEAR");
        if (current_year != null) {
            String current_year_string = current_year.toString();
            try {
                Chart chart = this.unitService.getNewDutiesYear(current_year_string).get(0);
                chart.setName("任现职务时间满" + current_year_string + "年");
                List<Chart> listD2 = new ArrayList<>();
                listD2.add(chart);
                list.addAll(listD2);
            } catch (Exception e4) {
            }
        }
        try {
            list.addAll(this.a79Service.getA79AWarning());//回避人员
        } catch (Exception e5) {
        }
        try {
            list.addAll(this.unitService.getProbation());//试用期满考核人员
        } catch (Exception e6) {
        }
        try {
            if (map.get("OVERMATCH").toString().equals("TRUE")) {
                list.addAll(this.unitService.getSurpassUnitCount(userId, null));//超配单位
            }
        } catch (Exception e7) {
        }
        try {
            if (map.get("UNDERMATCH").toString().equals("TRUE")) {
                list.addAll(this.unitService.getMissUnitCount(userId, null));//缺配单位
            }
        } catch (Exception e8) {
        }
        return list;
    }

    @GetMapping({"/totalWarningReportByUser2/{userId}"})
    @ApiOperation("获取预警数据（全部按用户）")
    public List<Chart> totalWarningReportByUser2(@PathVariable("userId") String userId) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        Map<String, Object> map = new HashMap<>();
        List<Chart> list = new ArrayList();
        warningIndexList.removeIf(next->next.getIsShow() ==1);
        for (WarningIndex warningIndex : warningIndexList) {
            switch (warningIndex.getKey()) {
                case "参加工作信息":
                    map.put("WORK_ENTER_AGE", warningIndex.getValue());
                    break;
                case "入党信息":
                    map.put("PARTY_ENTER_AGE", warningIndex.getValue());
                    break;
                case "退休人员信息": // 需要计算新的人员即将退休时间
                    String value = warningIndex.getValue(); // N个月
                    int months = Integer.parseInt(value); // 将字符串转换为整数
                    LocalDate currentDate = LocalDate.now(); // 获取当前日期
                    LocalDate futureDate = currentDate.plusMonths(months); // 计算N个月后的日期
                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
                    String formattedDate = futureDate.format(formatter); // 将日期格式化为字符串
                    LambdaQueryWrapper<Retirement>  ret = new LambdaQueryWrapper<>();
                    ret.ge(Retirement::getRetirement, formattedDate);
                    List<Retirement> list1 = retirementService.list(ret);
                    List<String> ids = list1.stream().map(Retirement::getFlowid).collect(Collectors.toList());
                    Chart chart = new Chart("3", "不满" + value + "个月即将退休人员数量", ids.size());
                    list.add(chart);
                    break;
                case "现任职务层次信息":
                    map.put("RANKNAME", warningIndex.getrank());
                    map.put("RANK_YEAR", warningIndex.getValue());
                    break;
                case "现职级信息":
                    map.put("LEVELNAME", warningIndex.getrank());
                    map.put("LEVEL_YEAR", warningIndex.getValue());
                    break;
                case "任现职信息":
                    map.put("CURRENT_YEAR", warningIndex.getValue());
                    break;
                case "奖励信息":
                    map.put("REWARD_YEAR", warningIndex.getValue());
                    break;
                case "惩戒信息":
                    map.put("PUNISH_YEAR", warningIndex.getValue());
                    break;
                case "超配信息":
                    list.addAll(this.unitService.getSurpassUnitCount(userId, null));//超配单位
                    break;
                case "缺配信息":
                    list.addAll(this.unitService.getMissUnitCount(userId, null));//缺配单位
                    break;
                default:
                    break;
            }
        }
        StringBuffer sbBuffer = createWarningSQL(map);//结果目前返回为空，里面是返回字符串的
        if (sbBuffer != null && sbBuffer.length() > 0) {
            list.addAll(this.indexService.totalWarningReportByStringBuffer(userId, null, sbBuffer.toString())); //拼接sql完成数据统计，一个代码返回
        }
        Object current_year = map.get("CURRENT_YEAR");
        if (current_year != null) {
            String current_year_string = current_year.toString();
            try {
                Chart chart = this.unitService.getNewDutiesYear(current_year_string).get(0);
                chart.setName("任现职务时间满" + current_year_string + "年");
                List<Chart> listD2 = new ArrayList<>();
                listD2.add(chart);
                list.addAll(listD2);
            } catch (Exception e4) {
            }
        }
        return list;
    }



    @RequestMapping(value = {"/inverseProbation"}, method = {RequestMethod.POST})
    @ApiOperation("试用期反向查询")
    public R inverseProbation(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseProbation();
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryAvoid"}, method = {RequestMethod.POST})
    @ApiOperation("回避人员反向查询")
    public R inverseQueryAvoid(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a79Service.inverseQueryAvoid();
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCurrentYear"}, method = {RequestMethod.POST})
    @ApiOperation("任现职务时间满X年反向查询")
    public R inverseQueryCurrentYear(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("任现职信息")).collect(Collectors.toList()).get(0);
        List<A01> list = this.a01Service.inverseQueryCurrentYear(warningIndex.getValue());
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp63"}, method = {RequestMethod.POST})
    @ApiOperation("首页人大、政协领导班子成员中的党外干部年满63周岁反向查询")
    public R inverseQueryCheckUp63(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryCheckUp63(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryPunish"}, method = {RequestMethod.POST})
    @ApiOperation("处分预警反向查询")
    public R inverseQueryPunish(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryPunish(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @GetMapping({"/queryJoinPartSummary"})
    @ApiOperation("首页图表统计党派结构")
    public List<Chart> queryJoinPartSummary(String userId, String unitCode) {
        return this.chartMsgService.queryJoinPartSummary(userId, unitCode);
    }

    @GetMapping({"/queryCadreSummary"})
    @ApiOperation("首页图表统计干部情况")
    public List<Chart> queryCadreSummary(String userId, String unitCode) {
        return this.chartMsgService.queryCadreSummary(userId, unitCode);
    }

    @GetMapping({"/queryEducationSummary"})
    @ApiOperation("首页图表统计学历情况")
    public List<Chart> queryEducationSummary(String userId, String unitCode, String status) {
        return this.chartMsgService.queryEducationSummary(userId, unitCode, status);
    }

    @GetMapping({"/queryNationSummary"})
    @ApiOperation("首页图表统计民族情况")
    public List<Chart> queryNationSummary(String userId, String unitCode) {
        return this.chartMsgService.queryNationSummary(userId, unitCode);
    }

    @GetMapping({"/querySexSummary"})
    @ApiOperation("首页图表统计性别情况")
    public List<Chart> querySexSummary(String userId, String unitCode) {
        return this.chartMsgService.querySexSummary(userId, unitCode);
    }

    @RequestMapping(value = {"/inverseQueryZhiji"}, method = {RequestMethod.POST})
    @ApiOperation("干部情况数据反向查询")
    public R inverseQueryZhiji(@RequestParam Map<String, Object> map) {
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e) {
        }
        List<A01> list = this.a01Service.inverseQueryZhijib(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryEducation"}, method = {RequestMethod.POST})
    @ApiOperation("学历情况数据反向查询")
    public R inverseQueryEducation(@RequestParam Map<String, Object> map) {
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e) {
        }
        List<A01> list = this.a01Service.inverseQueryEducationb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息不称职----数据反向查询")
    public R inverseQueryCheckUp(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryCheckUpb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp1"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息不称职----数据反向查询")
    public R inverseQueryCheckUp1(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryCheckUp1b(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp2"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息基本称职----数据反向查询")
    public R inverseQueryCheckUp2(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryCheckUp2b(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp3"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息不定等次----数据反向查询")
    public R inverseQueryCheckUp3(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryCheckUp3b(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp2_1"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息==相关考核等级----数据反向查询")
    public R inverseQueryCheckUp2_1(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("ASSESSMENT_1", mapConfigs.get("ASSESSMENT_1").toString());
        map.put("ASSESSMENT_1_YEAR", mapConfigs.get("ASSESSMENT_1_YEAR").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryCheckUp2_1(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp2_2"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息高于相关考核等级----数据反向查询")
    public R inverseQueryCheckUp2_2(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("ASSESSMENT_2", mapConfigs.get("ASSESSMENT_2").toString());
        map.put("ASSESSMENT_2_YEAR", mapConfigs.get("ASSESSMENT_2_YEAR").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryCheckUp2_2(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp2_3"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息低于相关考核等级----数据反向查询")
    public R inverseQueryCheckUp2_3(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("ASSESSMENT_3", mapConfigs.get("ASSESSMENT_3").toString());
        map.put("ASSESSMENT_3_YEAR", mapConfigs.get("ASSESSMENT_3_YEAR").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryCheckUp2_3(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryCheckUp2_4"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息连续几年相关考核等级----数据反向查询")
    public R inverseQueryCheckUp2_4(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("ASSESSMENT_4", mapConfigs.get("ASSESSMENT_4").toString());
        map.put("ASSESSMENT_4_YEAR", mapConfigs.get("ASSESSMENT_4_YEAR").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        int years = Integer.parseInt(map.get("ASSESSMENT_4_YEAR").toString());
        int nowyear = Calendar.getInstance().get(1);
        String yearStr = "";
        String pingJiaStr = "";
        for (int ix = 1; ix <= years; ix++) {
            yearStr = yearStr + "'" + String.valueOf(nowyear - ix) + "',";
            pingJiaStr = pingJiaStr + map.get("ASSESSMENT_4").toString() + ",";
        }
        String yearStr2 = yearStr.substring(0, yearStr.length() - 1);
        String pingJiaStr2 = pingJiaStr.substring(0, pingJiaStr.length() - 1);
        map.put("yearStr", yearStr2);
        map.put("pingJiaStr", pingJiaStr2);
        List<A01> list = this.a01Service.inverseQueryCheckUp2_4(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRetire"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息退休情况----数据反向查询")
    public R inverseQueryRetire(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryRetireb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRetirePERSON"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息退休情况全员----数据反向查询")
    public R inverseQueryRetirePERSON(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("PERSON_RETIRE_AGE", mapConfigs.get("PERSON_RETIRE_AGE").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRetireByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRetireMan"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息退休情况男----数据反向查询")
    public R inverseQueryRetireMan(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("a0105", "男");
        map.put("MAN_RETIRE_AGE", mapConfigs.get("MAN_RETIRE_AGE").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRetireByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRetireWoman"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息退休情况女----数据反向查询")
    public R inverseQueryRetireWoman(@RequestParam Map<String, Object> map) {
        List<SysConfigEntity> listConfigs = this.sysConfigService.queryWarningConfigs();
        Map<String, Object> mapConfigs = new HashMap<>();
        for (int i = 0; i < listConfigs.size(); i++) {
            try {
                mapConfigs.put(listConfigs.get(i).getParamKey(), listConfigs.get(i).getParamValue());
                mapConfigs.put(listConfigs.get(i).getParamKey() + "-REMARK", listConfigs.get(i).getRemark());
            } catch (Exception e) {
            }
        }
        map.put("a0105", "女");
        map.put("WOMAN_RETIRE_AGE", mapConfigs.get("WOMAN_RETIRE_AGE").toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRetireByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRetireMonth"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息退休情况即将退休----数据反向查询")
    public R inverseQueryRetireMonth(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("退休人员信息")).collect(Collectors.toList()).get(0);
        String value = warningIndex.getValue(); // N个月
        int months = Integer.parseInt(value); // 将字符串转换为整数
        LocalDate currentDate = LocalDate.now(); // 获取当前日期
        LocalDate futureDate = currentDate.plusMonths(months); // 计算N个月后的日期
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
        String formattedDate = futureDate.format(formatter); // 将日期格式化为字符串
        LambdaQueryWrapper<Retirement>  ret = new LambdaQueryWrapper<>();
        ret.ge(Retirement::getRetirement, formattedDate);
        List<Retirement> list1 = retirementService.list(ret);
        map.put("ids", list1.stream().map(Retirement::getFlowid).collect(Collectors.toList()));
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRetireByConfigByList(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryWorkInAdvance"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息未满18参加工作情况----数据反向查询")
    public R inverseQueryWorkInAdvance(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryWorkInAdvanceb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryWorkInAdvanceByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息未满18参加工作情况Config----数据反向查询")
    public R inverseQueryWorkInAdvanceConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("参加工作信息")).collect(Collectors.toList()).get(0);
        map.put("WORK_ENTER_AGE", warningIndex.getValue());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryWorkInAdvancebConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryAheadJoinparty"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息未满18入党情况----数据反向查询")
    public R inverseQueryAheadJoinparty(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryAheadJoinpartyb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryAheadJoinpartyByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息未满18入党情况Config----数据反向查询")
    public R inverseQueryAheadJoinpartyConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list();
        WarningIndex rdxx = warningIndexList.stream().filter(next -> next.getKey().equals("入党信息")).collect(Collectors.toList()).stream().findFirst().get();
        map.put("PARTY_ENTER_AGE", rdxx.getValue().toString());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryAheadJoinpartyConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryPositionLevelByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息职务层次任职年限情况Config----数据反向查询")
    public R inverseQueryPositionLevelByConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("现任职务层次信息")).collect(Collectors.toList()).get(0);
        map.put("RANK_YEAR", warningIndex.getValue());
        map.put("RANKNAME", warningIndex.getrank());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryPositionLevelByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRankByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息职级任职年限情况Config----数据反向查询")
    public R inverseQueryRankByConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("现职级信息")).collect(Collectors.toList()).get(0);
        map.put("LEVELNAME", warningIndex.getrank());
        map.put("LEVEL_YEAR", warningIndex.getValue());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRankByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryInthetime"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息--影响期内干部----数据反向查询")
    public R inverseQueryInthetime(@RequestParam Map<String, Object> map) {
        List<A01> list = this.a01Service.inverseQueryInthetimeb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryRewardByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息--奖励人员----数据反向查询")
    public R inverseQueryRewardByConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("奖励信息")).collect(Collectors.toList()).get(0);
        map.put("REWARD_YEAR", warningIndex.getValue());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryRewardByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/inverseQueryPunishmentByConfig"}, method = {RequestMethod.POST})
    @ApiOperation("预警信息--惩罚人员----数据反向查询")
    public R inverseQueryPunishmentByConfig(@RequestParam Map<String, Object> map) {
        List<WarningIndex> warningIndexList = warningIndexService.list(new LambdaQueryWrapper());
        WarningIndex warningIndex = warningIndexList.stream().filter(next -> next.getKey().equals("惩戒信息")).collect(Collectors.toList()).get(0);
        map.put("PUNISH_YEAR", warningIndex.getValue());
        try {
            if (map.get("unitCode") != null) {
                List<String> uList = Arrays.asList(map.get("unitCode").toString().split(","));
                map.remove("unitCode");
                map.put("uList", uList);
            }
        } catch (Exception e2) {
        }
        List<A01> list = this.a01Service.inverseQueryPunishmentByConfig(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/getSurpassUnit"}, method = {RequestMethod.POST})
    @ApiOperation("超编单位----数据反向查询")
    public R getSurpassUnit(@RequestParam Map<String, Object> map) {
        List<B01> list = this.unitService.getSurpassUnitb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }

    @RequestMapping(value = {"/getMissUnit"}, method = {RequestMethod.POST})
    @ApiOperation("缺编单位----数据反向查询")
    public R getMissUnit(@RequestParam Map<String, Object> map) {
        List<B01> list = this.unitService.getMissUnitb(map);
        return R.ok().put("data", (Object) list).put("count", (Object) Integer.valueOf(list.size()));
    }
}
